/**
 * 直拨业务服务类
 * 提供订单管理、客户查询、附件处理等功能的 API 接口
 */
export class DirectService {
  /**
   * 查询客户列表
   * @param payload - 查询参数对象
   * @returns Promise<any> 返回客户列表数据
   */
  static async queryCustomerList(payload: Record<string, string>) {
    const response = await http.web.formDataPost('/api/diractDial/queryCustomerList', payload);
    return response.data;
  }

  /**
   * 查询分支机构列表
   * @param payload - 查询参数对象，可包含字符串或数字类型的属性
   * @returns Promise<any> 返回分支机构详情列表数据
   */
  static async queryContractDtlList(payload: Record<string, number>) {
    const response = await http.web.formDataPost('/api/diractDial/queryContractDtlList', payload, {
      showLoading: false,
    });
    return response.data;
  }

  /**
   * 查询订单总单列表
   * @param payload - 查询参数对象，可包含字符串或数字类型的属性
   * @returns Promise<any> 返回订单总单列表数据
   */
  static async queryOrderList(payload: Record<string, string | number>) {
    const response = await http.web.formDataPost('/api/diractDial/queryOrderList', payload);
    return response.data;
  }

  /**
   * 查询订单总单详情
   * @param payload - 查询参数对象，可包含字符串或数字类型的属性
   * @returns Promise<any> 返回订单总单列表数据
   */
  static async queryOrderDocDetail(payload: Record<string, number>) {
    const response = await http.web.formDataPost('/api/diractDial/queryOrderDocDetail', payload);
    return response.data;
  }

  /**
   * 查询运输地址
   * @param payload - 查询参数对象，可包含数字类型的属性
   * @returns Promise<any> 返回运输地址列表数据
   */
  static async queryAddress(payload: Record<string, number>) {
    const response = await http.web.formDataPost('/api/diractDial/queryAddress', payload);
    return response.data;
  }

  /**
   * 查询物流中心
   * @param payload - 查询参数对象，可包含数字类型的属性
   * @returns Promise<any> 返回物流中心列表数据
   */
  static async queryLogisticsCenter(payload: Record<string, number>) {
    const response = await http.web.formDataPost('/api/diractDial/queryLogisticsCenter', payload);
    return response.data;
  }

  /**
   * 查询直调人员
   * @param payload - 查询参数对象，可包含数字类型的属性
   * @returns Promise<any> 返回直调人员列表数据
   */
  static async queryDirectrgMan(payload: Record<string, number>) {
    const response = await http.web.formDataPost('/api/diractDial/queryDirectrgMan', payload);
    return response.data;
  }

  /**
   * 查询订单附件
   * @param payload - 查询参数对象，包含订单ID等数字类型参数
   * @returns Promise<any> 返回订单附件列表数据
   */
  static async queryOrderFile(payload: Record<string, number>) {
    const response = await http.web.formDataPost('/api/diractDial/queryOrderFile', payload);
    return response.data;
  }

  /**
   * 查询订单细单列表
   * @param payload - 查询参数对象，可包含字符串或数字类型的属性
   * @returns Promise<any> 返回订单细单列表数据
   */
  static async queryOrderDtlList(payload: Record<string, string | number>) {
    const response = await http.web.formDataPost('/api/diractDial/queryOrderDtlList', payload);
    return response.data;
  }

  /**
   * 根据 UDI 码查询品种信息
   * @param payload - 查询参数对象，包含 UDI 码等信息
   * @returns Promise<any> 返回品种详情数据
   */
  static async queryGoodsByUdi(payload: Record<string, string | number>) {
    const response = await http.web.formDataPost('/api/diractDial/queryGoodsByUdi', payload);
    return response.data;
  }

  /**
   * 新增订单总单
   * @param payload - 订单总单信息对象
   * @returns Promise<any> 返回新增结果
   */
  static async addOrder(payload: Record<string, string | number>) {
    const response = await http.web.formDataPost('/api/diractDial/addOrder', payload);
    return response.data;
  }

  /**
   * 新增订单细单
   * @param payload - 订单细单信息对象
   * @returns Promise<any> 返回新增结果
   */
  static async addOrderDtl(payload: Record<string, string | number>) {
    const response = await http.web.formDataPost('/api/diractDial/addOrderDtl', payload);
    return response.data;
  }

  /**
   * 添加图片附件
   * @param payload - 图片信息对象，包含图片路径、关联ID等
   * @returns Promise<any> 返回添加结果
   */
  static async addPicture(payload: Record<string, string | number>) {
    const response = await http.web.formDataPost('/api/diractDial/addPicture', payload);
    return response.data;
  }

  /**
   * 修改订单总单
   * @param payload - 订单总单信息对象，包含需要修改的字段
   * @returns Promise<any> 返回修改结果
   */
  static async modifyOrder(payload: Record<string, string | number>) {
    const response = await http.web.formDataPost('/api/diractDial/modifyOrder', payload);
    return response.data;
  }

  /**
   * 修改订单细单
   * @param payload - 订单细单信息对象，包含需要修改的字段
   * @returns Promise<any> 返回修改结果
   */
  static async modifyOrderDtl(payload: Record<string, string | number>) {
    const response = await http.web.formDataPost('/api/diractDial/modifyOrderDtl', payload);
    return response.data;
  }

  /**
   * 删除订单细单
   * @param payload - 删除参数对象，包含订单ID
   * @returns Promise<any> 返回删除结果
   */
  static async deleteOrderDtl(payload: Record<string, number>) {
    const response = await http.web.formDataPost('/api/diractDial/deleteOrderDtl', payload);
    return response.data;
  }

  /**
   * 删除订单总单
   * @param payload - 删除参数对象，包含订单ID
   * @returns Promise<any> 返回删除结果
   */
  static async deleteOrder(payload: Record<string, number>) {
    const response = await http.web.formDataPost('/api/diractDial/deleteOrder', payload);
    return response.data;
  }

  /**
   * 删除图片附件
   * @param payload - 删除参数对象，包含图片ID
   * @returns Promise<any> 返回删除结果
   */
  static async delPicture(payload: Record<string, number>) {
    const response = await http.web.formDataPost('/api/diractDial/delPicture', payload);
    return response.data;
  }

  /**
   * 提交订单
   * @param payload - 提交参数对象，包含订单ID等信息
   * @returns Promise<any> 返回提交结果
   */
  static async submitDirect(payload: Record<string, string | number>) {
    const response = await http.web.formDataPost('/api/diractDial/submit', payload);
    return response.data;
  }
}
